if (typeof UWA == "undefined" || !UWA) var UWA = {};

/* UWA - Prototype driver */

UWA.Class = {
  create: function() {
    return Class.create();
  }
}

UWA.Form = {
  getElements: function(form) {
    return Form.getElements(form);
  }
}

UWA.Ajax = {
  Request: function(url, request) {
    return new Ajax.Request(url, request)
  },
  onCompleteXML: function(arg, callback, context) {
    callback(arg[0].responseXML)
  },
  onCompleteText: function(arg, callback, context) {
    callback(arg[0].responseText)
  },
  onCompleteFeed: function(arg, callback, context) {
    var feed = UWA.Utils.parseFeed(arg[0]);
    if(typeof callback == "function") callback(feed)
  },
  onCompleteJson: function(arg, callback, context) {
    try {
      eval("var j = " + arg[0].responseText);
      callback(j, context);
    } catch(e) {
      UWA.log(e);
    }
  }
}

UWA.$element = function(el){
  if (el) {
    if (!el.isUwaExtended) {
      UWA.extend(el, UWA.Element);
      el.isUwaExtended = true;
    }
    return $(el);
  }
}

if (typeof UWA.Element == "undefined") UWA.Element = {};

//if (typeof UWA.Element.methods == "undefined") UWA.Element.methods = {};

UWA.extend( UWA.Element , {
  
  setStyle: function(arg1, arg2) {
    if (typeof arg1 == 'string' && typeof arg2 != 'undefined') { // key&value syntax
      var property = arg1.camelize();
      this.style[property] = arg2;
    } else { // default prototype.js syntax
       return Element.setStyle(this, arg1);
    }
  }
  
} );